package com.tzw.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tzw.pojo.BasicKhal;
import com.tzw.pojo.ModuleOfProduct;
import com.tzw.service.BasicKhalService;
import com.tzw.service.ModuleOfProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 客户案例接口
 * */
@Controller
@RequestMapping("/clientCase")
public class ClientCaseController {
    @Autowired
    private ModuleOfProductService moduleOfProductService;
    @Autowired
    private BasicKhalService basicKhalService;
    @GetMapping("/{page}")
    public String aboutView(Model model,
                            @PathVariable(value = "page")Integer page){
        List<ModuleOfProduct> productList = moduleOfProductService.list();
        IPage<BasicKhal> khalIPage = basicKhalService.page(new Page<>(page, 10));
        model.addAttribute("prdList",productList);
        model.addAttribute("clientList",khalIPage.getRecords());
        model.addAttribute("page",khalIPage.getPages());
        model.addAttribute("current",khalIPage.getCurrent());
        return "/client_Case";
    }

}
